package edu.nf.ch08.service;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;

/**
 * @author wangl
 * @date 2025/4/29
 */
@Service
@PropertySource("classpath:host.properties")
public class UserService {

    /**
     * 使用@Value注解注入资源文件的属性值，
     * 结合SPEL表达式根据资源文件的key读取value
     */
    @Value("${url}")
    private String url;
    @Value("${port}")
    private Integer port;

    public void print() {
        System.out.println(url);
        System.out.println(port);
    }
}